package com.cardone.platform.common.service;

import java.util.List;

import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.transaction.annotation.Transactional;

import com.cardone.common.cache.Caches;
import com.cardone.common.dto.PaginationDto;
import com.cardone.platform.common.dto.EntityFileDto;

/**
 * 实体文件服务
 *
 * @author yaohaitao
 */
public interface EntityFileService {
	/**
	 * spring bean id
	 */
	String BEAN_ID = "com.cardone.platform.common.service.EntityFileService";

	/**
	 * 保存:实体文件
	 *
	 * @param mappedClass
	 *          返回类型
	 *
	 * @param saveEntityFile
	 *          实体文件对象
	 *
	 * @return 实体文件对象
	 */
	@Transactional
	@CacheEvict(value = EntityFileService.BEAN_ID, allEntries = true)
	<P> P saveByIdOrCode(final Class<P> mappedClass, final EntityFileDto saveEntityFile);

	/**
	 * 插入
	 *
	 * @param insertEntityFile
	 *          实体文件对象
	 *
	 * @return 影响行数
	 */
	@Transactional
	@CacheEvict(value = EntityFileService.BEAN_ID, allEntries = true)
	int insertByCode(final EntityFileDto insertEntityFile);

	/**
	 * 删除
	 *
	 * @param deleteEntityFile
	 *          实体文件对象
	 *
	 * @return 影响行数
	 */
	@Deprecated
	@Transactional
	@CacheEvict(value = EntityFileService.BEAN_ID, allEntries = true)
	int deleteByIds(final EntityFileDto deleteEntityFile);

	/**
	 * 更新
	 *
	 * @param updateEntityFile
	 *          实体文件对象
	 *
	 * @return 影响行数
	 */
	@Deprecated
	@Transactional
	@CacheEvict(value = EntityFileService.BEAN_ID, allEntries = true)
	int updateByCode(final EntityFileDto updateEntityFile);

	/**
	 * 查询
	 *
	 * @param readEntityFile
	 *          实体文件对象
	 * @return 返回数据
	 */
	@Deprecated
	@Cacheable(value = EntityFileService.BEAN_ID, key = Caches.KEY_1)
	Integer readByCodeNqIdForCount(final EntityFileDto readEntityFile);

	/**
	 * 查询
	 *
	 * @param mappedClass
	 *          返回类型
	 *
	 * @param findEntityFile
	 *          实体文件对象
	 * @return 返回对象
	 */
	@Cacheable(value = EntityFileService.BEAN_ID, key = Caches.KEY_2)
	<P> P findById(final Class<P> mappedClass, final EntityFileDto findEntityFile);

	/**
	 * 查询
	 *
	 * @param mappedClass
	 *          返回类型
	 *
	 * @param findEntityFile
	 *          实体文件对象
	 *
	 * @return 返回对象
	 */
	@Deprecated
	@Cacheable(value = EntityFileService.BEAN_ID, key = Caches.KEY_2)
	<P> P findByCodeOrId(final Class<P> mappedClass, final EntityFileDto findEntityFile);

	/**
	 * 查询
	 *
	 * @param mappedClass
	 *          返回类型
	 *
	 * @param findListEntityFile
	 *          实体文件对象
	 *
	 * @return 实体文件对象集合
	 */
	@Deprecated
	@Cacheable(value = EntityFileService.BEAN_ID, key = Caches.KEY_2)
	<P> List<P> findListByLikeCode(final Class<P> mappedClass, final EntityFileDto findListEntityFile);

	/**
	 * 分页
	 *
	 * @param mappedClass
	 *          返回类型
	 *
	 * @param paginationEntityFile
	 *          实体文件对象
	 *
	 * @return 实体文件分页对象
	 */
	@Deprecated
	@Cacheable(value = EntityFileService.BEAN_ID, key = Caches.KEY_2)
	<P> PaginationDto<P> paginationByLikeCode(final Class<P> mappedClass, final EntityFileDto paginationEntityFile);
}